package com.zzs.client.dao.mysql;

import com.zzs.common.core.entity.mysql.CodeSubmitDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author zzs
 */
@Mapper
public interface CodeSubmitMapper {
    @Select("select id, language, code, status, message, input, output, user_output, use_time, use_memory, create_time from code_submit where id = #{id}")
    CodeSubmitDO getCodeSubmitDetail(@Param("id") long id);

    @Select("select id, language, status, use_time, use_memory, create_time from code_submit where user_id = #{userId} and problem_id = #{problemId} order by create_time desc")
    List<CodeSubmitDO> listCodeSubmits(@Param("userId") long userId, @Param("problemId") long problemId);
}
